package model

import (
	"WebFacade/model/es"
	"WebFacade/model/mgo"
	"WebFacade/model/mysql"
	"WebFacade/model/redis"
)

func Init(
	useMysql bool,
	mysqlUserName string,
	mysqlPassWord string,
	mysqlHost string,
	mysqlPort int,
	mysqlDbName string,
	mysqlDebug bool,
	mysqlSalve bool,

	useRedis bool,
	redisHost string,
	redisPort int,
	redisPassWord string,
	redisDB int,
	redisPoolSize int,

	useMgo bool,
	mgoHost string,
	mgoPort int,
	mgoDBName string,
	mgoAuthDB string,
	mgoUserName string,
	mgoPassword string,
	mgoAuth bool,

	useEs bool,
	esURL string,

	env string,
) {

	// 初始化mysql
	if useMysql {
		mysql.Init(
			mysqlUserName,
			mysqlPassWord,
			mysqlHost,
			mysqlPort,
			mysqlDbName,
			mysqlDebug,
			mysqlSalve,
		)
	}

	// 初始化redis
	if useRedis {
		redis.Init(
			redisHost,
			redisPort,
			redisPassWord,
			redisDB,
			redisPoolSize,
			env,
		)
	}

	// 初始化mongo
	if useMgo {
		mgo.Init(
			mgoHost,
			mgoPort,
			mgoDBName,
			mgoAuthDB,
			mgoUserName,
			mgoPassword,
			mgoAuth,
		)
	}

	// 初始化es
	if useEs {
		es.InitEs(
			esURL,
		)
	}
}
